<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Forpastime < forpastime@qq.com>
// +----------------------------------------------------------------------
namespace app\tenant_user\model;

use think\db\Query;
use think\Model;
use tree\Tree;

class UserModel extends Model{

    protected $name = 'tenant_user';

    public function getList($filter,$order,$userLogin, $area)
    {
        $list = $this->where(function (Query $query) use ($filter,$userLogin, $area) {
                if ($userLogin) {
                    $query->where('name', 'like', "%$userLogin%");
                }
                if ($area) {
                    $query->where('area_value', 'like', "%$area%");
                }

                if(!empty($filter['shop_info_id'])){
                    $query->where('shop_info_id',$filter['shop_info_id']);
                }
            })
            ->where('status',1)
            ->order($order)
            ->paginate(10);
        $list->appends($filter);
        return $list;
    }
}